package net.lahuobao.mall.entity.admin;

import java.math.BigDecimal;
import java.util.Date;

import javax.persistence.*;

import net.lahuobao.export.datasoruce.annotation.ExportField;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.jeecgframework.web.system.pojo.base.TSBaseUser;

/**   
 * @Title: Entity
 * @Description: 结算规则
 * @author zhangdaihao
 * @date 2016-10-09 10:40:46
 * @version V1.0   
 *
 */
@Entity
@Table(name = "mall_shop_settle_period", schema = "lahuobao")
@DynamicUpdate(true)
@DynamicInsert(true)
@SuppressWarnings("serial")
public class MallShopSettlePeriodEntity implements java.io.Serializable {

	/**id*/
	@ExportField(title="", isShow = 0)
	private java.lang.Integer id;

	/**shopid*/
	@ExportField(title="", isShow = 0)
	private java.lang.Integer shopid;

	@ExportField(title="商家名称",sort=10)
	private String companyname;

	@ExportField(title="店铺名称",sort=20)
	private String shopName;

	/**settledaycount*/
	@ExportField(title="结算周期(天)",sort=30)
	private java.lang.Integer settledaycount;

	/**settlerate*/
	@ExportField(title="交易服务费(%)",sort=40)
	private BigDecimal settlerate;

	/**settlerate*/
	@ExportField(title="", isShow = 0)
	private BigDecimal settlerateshow;

	/**settlerateadvance*/
	@ExportField(title="提前结算费(%)",sort=50)
	private BigDecimal settlerateadvance;

	@ExportField(title="", isShow = 0)
	private BigDecimal settlerateadvanceshow;

	@ExportField(title="联系人",sort=60)
	private String contactperson;

	@ExportField(title="手机号",sort=70)
	private String phonenumber;

	@ExportField(title="地址",sort=80)
	private String contactaddress;

	@ExportField(title="店铺状态",sort=90)
	private String shopstatus;

	@ExportField(title="编辑人",sort=100)
	private String createUserName;

	@ExportField(title="编辑时间", sort=100, isTranf=1, tranfType=2)
	private java.util.Date createtime;

	/**状态1有效 0无效*/
	@ExportField(title="",isShow = 0)
	private java.lang.Integer status;

	/**createuserid*/
	@ExportField(title="",isShow = 0)
	private java.lang.Integer createuserid;

	/*商铺*/
	@ExportField(title="",isShow = 0)
	private MallShopEntity mallShop;

	/*用户*/
	@ExportField(title="",isShow = 0)
	private TSBaseUser baseUser;
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  id
	 */
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name ="ID",nullable=false,precision=10,scale=0)
	public java.lang.Integer getId(){
		return this.id;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  id
	 */
	public void setId(java.lang.Integer id){
		this.id = id;
	}
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  shopid
	 */
	@Column(name ="SHOPID",nullable=false,precision=10,scale=0)
	public java.lang.Integer getShopid(){
		return this.shopid;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  shopid
	 */
	public void setShopid(java.lang.Integer shopid){
		this.shopid = shopid;
	}
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  settledaycount
	 */
	@Column(name ="SETTLEDAYCOUNT",nullable=false,precision=10,scale=0)
	public java.lang.Integer getSettledaycount(){
		return this.settledaycount;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  settledaycount
	 */
	public void setSettledaycount(java.lang.Integer settledaycount){
		this.settledaycount = settledaycount;
	}
	/**
	 *方法: 取得BigDecimal
	 *@return: BigDecimal  settlerate
	 */
	@Column(name ="SETTLERATE",nullable=false,precision=18,scale=2)
	public BigDecimal getSettlerate(){
		//return (this.settlerate.multiply(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
		return this.settlerate;
	}

	/**
	 *方法: 设置BigDecimal
	 *@param: BigDecimal  settlerate
	 */
	public void setSettlerate(BigDecimal settlerate){
		this.settlerate = settlerate;
	}
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  状态1有效 0无效
	 */
	@Column(name ="STATUS",nullable=false,precision=10,scale=0)
	public java.lang.Integer getStatus(){
		return this.status;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  状态1有效 0无效
	 */
	public void setStatus(java.lang.Integer status){
		this.status = status;
	}
	/**
	 *方法: 取得java.util.Date
	 *@return: java.util.Date  createtime
	 */
	@Column(name ="CREATETIME",nullable=false)
	public java.util.Date getCreatetime(){
		return this.createtime;
	}

	/**
	 *方法: 设置java.util.Date
	 *@param: java.util.Date  createtime
	 */
	public void setCreatetime(java.util.Date createtime){
		this.createtime = createtime;
	}
	/**
	 *方法: 取得java.lang.Integer
	 *@return: java.lang.Integer  createuserid
	 */
	@Column(name ="CREATEUSERID",nullable=false,precision=10,scale=0)
	public java.lang.Integer getCreateuserid(){
		return this.createuserid;
	}

	/**
	 *方法: 设置java.lang.Integer
	 *@param: java.lang.Integer  createuserid
	 */
	public void setCreateuserid(java.lang.Integer createuserid){
		this.createuserid = createuserid;
	}
	/**
	 *方法: 取得BigDecimal
	 *@return: BigDecimal  settlerateadvance
	 */
	@Column(name ="SETTLERATEADVANCE",nullable=false,precision=18,scale=2)
	public BigDecimal getSettlerateadvance(){
		return this.settlerateadvance;
	}

	/**
	 *方法: 设置BigDecimal
	 *@param: BigDecimal  settlerateadvance
	 */
	public void setSettlerateadvance(BigDecimal settlerateadvance){
		this.settlerateadvance = settlerateadvance;
	}

	@OneToOne
	@JoinColumn(name = "shopid", insertable = false, updatable = false)
	public MallShopEntity getMallShop() {
		return mallShop;
	}

	public void setMallShop(MallShopEntity mallShop) {
		this.mallShop = mallShop;
	}

	@Transient
	public BigDecimal getSettlerateshow() {
		return (this.settlerate.multiply(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
	}

	public void setSettlerateshow(BigDecimal settlerateshow) {
		this.settlerateshow = settlerateshow;
	}

	@Transient
	public BigDecimal getSettlerateadvanceshow() {

		return 	(this.settlerateadvance.multiply(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP);
	}

	public void setSettlerateadvanceshow(BigDecimal settlerateadvanceshow) {
		this.settlerateadvanceshow = settlerateadvanceshow;
	}

	@Transient
	public String getShopName() {
		return this.getMallShop().getShopname();
	}

	public void setShopName(String shopName) {
		this.shopName = shopName;
	}

	/*@OneToOne
	@JoinColumn(name = "createuserid")*/
	@Transient
	public TSBaseUser getBaseUser() {
		return baseUser;
	}

	public void setBaseUser(TSBaseUser baseUser) {
		this.baseUser = baseUser;
	}

	@Transient
	public String getCompanyname() {
		return this.getMallShop().getCompanyname();
	}

	public void setCompanyname(String companyname) {
		this.companyname = companyname;
	}

	@Transient
	public String getContactperson() {
		return this.getMallShop().getContactperson();
	}

	public void setContactperson(String contactperson) {
		this.contactperson = contactperson;
	}

	@Transient
	public String getPhonenumber() {
		return this.getMallShop().getPhonenumber();
	}

	public void setPhonenumber(String phonenumber) {
		this.phonenumber = phonenumber;
	}

	@Transient
	public String getContactaddress() {
		return this.getMallShop().getContactaddress();
	}

	public void setContactaddress(String contactaddress) {
		this.contactaddress = contactaddress;
	}

	@Transient
	public String getShopstatus() {
		String returnStr = "";
		switch (this.getMallShop().getShopstatus()){
			case 1:
				returnStr = "在营";
				break;
			case 2:
				returnStr =  "关闭";
				break;
			case 3:
				returnStr =  "暂停";
				break;
			case 4:
				returnStr =  "审核中";
				break;
			case 5:
				returnStr =  "未通过";
				break;
			case 6:
				returnStr =  "未通过";
				break;
		}
		return returnStr;
	}

	public void setShopstatus(String shopstatus) {
		this.shopstatus = shopstatus;
	}

	@Transient
	public String getCreateUserName() {
		return this.getBaseUser().getUserName();
	}

	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
}
